package com.huike.clues.service.impl;


import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {

    @Autowired
    private TbClueMapper tbClueMapper;

    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;

    //添加线索跟进
    @Override
    @Transactional
    public void add(TbClueTrackRecord tbClueTrackRecord, TbClue tbClue) {
        //1. 向线索跟进记录表保存记录
        tbClueTrackRecordMapper.insert(tbClueTrackRecord);

        //2. 向线索表更新数据(已经提供)
        tbClueMapper.updateTbClue(tbClue);
    }

    //跟进线索id查询线索跟进记录
    @Override
    public List<TbClueTrackRecord> findListByClueId(Long clueId) {
        return tbClueTrackRecordMapper.findListByClueId(clueId);
    }
}

